package com.dmap.analysispoint.service.impl;

import com.dmap.analysispoint.bo.ActivePhoneBo;
import com.dmap.analysispoint.bo.AddAndActivePhoneBo;
import com.dmap.analysispoint.bo.DataBoardBo;
import com.dmap.analysispoint.bo.NameAndValueBo;
import com.dmap.analysispoint.constants.BurialPointConstant;
import com.dmap.analysispoint.controller.background.param.CountParam;
import com.dmap.analysispoint.rpc.RpcAppInfoService;
import com.dmap.analysispoint.rpc.RpcCompanyInfoService;
import com.dmap.analysispoint.service.*;
import com.dmap.analysispoint.utils.VersionUtils;
import com.dmap.base.cache.impl.BaseCacheDaoStringImpl;
import com.dmap.base.units.DateUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * \* @author:zhouhao
 * \* Date:11/05/2018
 * \* Description:数据看板
 * \*
 */
@Service
public class DataBoardServiceImpl extends BaseCacheDaoStringImpl implements DataBoardService {

    private static final Logger logger = LoggerFactory.getLogger(DataBoardServiceImpl.class);

    @Resource
    private PhoneInfoAnalysisService phoneInfoAnalysisService;
    @Resource
    private EquipmentInfoAnalysisService equipmentInfoAnalysisService;
    @Resource
    private ParamDoService paramDoService;
    @Resource
    private BurialPointAddAndActivePhoneService burialPointAddAndActivePhoneService;
    @Resource
    private RpcCompanyInfoService rpcCompanyInfoService;
    @Resource
    private RpcAppInfoService rpcAppInfoService;


    @Override
    public List<List> dataBoardAnalysisList(CountParam param) {

        //获得当天新增手机数、当天活跃手机数、累积手机数、累积设备数
        List<Integer> countList = this.countPhoneEquipmentNumList(param);

        //获得本周/上周、本月/上月同时间段和近七天每天的的新增手机数、活跃手机数
        List<List> countPhoneList = this.addAndActivePhoneList(param);

        List<List> dataBoardAnalysisList = new ArrayList<>();
        dataBoardAnalysisList.add(0, countList);
        dataBoardAnalysisList.add(1, countPhoneList.get(0));
        dataBoardAnalysisList.add(2, countPhoneList.get(1));
        return dataBoardAnalysisList;
    }

    /**
     * @param param String companyId;       公司编号
     *              String place;           渠道
     *              String projectId;       项目编号
     *              String firmwareId;      设备固件编号
     *              String firmwareVersion; 设备固件版本号
     *              String appVersion;      app版本号
     *              Long startTime;         查询的开始时间
     *              Long endTime;           查询的结束时间
     * @return countPhoneEquipmentNumList   获得当天新增手机数、当天活跃手机数、累积手机数、累积设备数
     */
    private List<Integer> countPhoneEquipmentNumList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        CountParam countParam = paramDoService.getParam(param);
        int addPhoneNum = 0;
        int activePhoneNum = 0;
        int allPhoneNum = 0;
        int allEquipmentNum = 0;
        long startTime = countParam.getStartTime();
        long endTIme = countParam.getEndTime();

        //当登录管理员为分公司管理员时执行
        if (countParam.getCompanyId() != null && StringUtils.isBlank(countParam.getProjectId())) {
            //获得所需数据,先从缓存中获取，若缓存中没有，则从数据库中获取并加入缓存
            String key = BurialPointConstant.CACHE_ANALYSIS_POINT_COMPANY_INFO_CODE + countParam.getCompanyId();
            String value = getKV(key);
            if (StringUtils.isBlank(value)) {
                DataBoardBo dataBoardBo = new DataBoardBo();
                List<String> companyProjectList = rpcCompanyInfoService.selectByCompanyId(countParam.getCompanyId());
                for (String projectId : companyProjectList) {
                    countParam.setStartTime(startTime);
                    countParam.setEndTime(endTIme);
                    countParam.setCompanyId(null);
                    countParam.setProjectId(projectId);
                    addPhoneNum = addPhoneNum + phoneInfoAnalysisService.countAddPhoneNum(countParam);
                    activePhoneNum = activePhoneNum + phoneInfoAnalysisService.countActivePhoneNumByBurialPoint(projectId, countParam.getStartTime(), countParam.getEndTime());
                    countParam.setStartTime(0L);
                    allPhoneNum = allPhoneNum + phoneInfoAnalysisService.countAddPhoneNum(countParam);
                    allEquipmentNum = allEquipmentNum + equipmentInfoAnalysisService.countEquipmentNum(countParam);
                }
                dataBoardBo.setAddPhoneNum(addPhoneNum);
                dataBoardBo.setActivePhoneNum(activePhoneNum);
                dataBoardBo.setAllPhoneNum(allPhoneNum);
                dataBoardBo.setAllEquipmentNum(allEquipmentNum);
                addKV(key, dataBoardBo.toString(), BurialPointConstant.CACHE_TIME_ONE_DAY);
            } else {
                DataBoardBo dataBoardCacheBo = new DataBoardBo();


                ObjectMapper mapper = new ObjectMapper();
                try {
                    dataBoardCacheBo = mapper.readValue(value, DataBoardBo.class);
                } catch (Exception e) {
                    logger.error("String to dataBoardCacheBo(前缀companyId) error" + e);
                }
                addPhoneNum = dataBoardCacheBo.getAddPhoneNum();
                activePhoneNum = dataBoardCacheBo.getActivePhoneNum();
                allPhoneNum = dataBoardCacheBo.getAllPhoneNum();
                allEquipmentNum = dataBoardCacheBo.getAllEquipmentNum();
            }
        }
        //当登录管理员为项目管理员时执行
        else if (countParam.getCompanyId() != null && !StringUtils.isBlank(countParam.getProjectId())) {
            //获得所需数据,先从缓存中获取，若缓存中没有，则从数据库中获取并加入缓存
            String key = BurialPointConstant.CACHE_ANALYSIS_POINT_PROJECT_INFO_CODE + countParam.getProjectId();
            String value = getKV(key);
            if (StringUtils.isBlank(value)) {
                DataBoardBo dataBoardBo = new DataBoardBo();
                addPhoneNum = phoneInfoAnalysisService.countAddPhoneNum(countParam);
                activePhoneNum = phoneInfoAnalysisService.countActivePhoneNumByBurialPoint(countParam.getProjectId(), countParam.getStartTime(), countParam.getEndTime());
                countParam.setStartTime(0L);
                allPhoneNum = phoneInfoAnalysisService.countAddPhoneNum(countParam);
                allEquipmentNum = equipmentInfoAnalysisService.countEquipmentNum(countParam);
                dataBoardBo.setAddPhoneNum(addPhoneNum);
                dataBoardBo.setActivePhoneNum(activePhoneNum);
                dataBoardBo.setAllPhoneNum(allPhoneNum);
                dataBoardBo.setAllEquipmentNum(allEquipmentNum);
                addKV(key, dataBoardBo.toString(), BurialPointConstant.CACHE_TIME_ONE_DAY);
            } else {
                DataBoardBo dataBoardCacheBo = new DataBoardBo();
                ObjectMapper mapper = new ObjectMapper();
                try {
                    dataBoardCacheBo = mapper.readValue(value, DataBoardBo.class);
                } catch (Exception e) {
                    logger.error("String to dataBoardCacheBo(前缀ProjectId) error" + e);
                }
                addPhoneNum = dataBoardCacheBo.getAddPhoneNum();
                activePhoneNum = dataBoardCacheBo.getActivePhoneNum();
                allPhoneNum = dataBoardCacheBo.getAllPhoneNum();
                allEquipmentNum = dataBoardCacheBo.getAllEquipmentNum();
            }
        }
        //当登录管理员为总公司管理员时执行
        else {
            //获得所需数据,先从缓存中获取，若缓存中没有，则从数据库中获取并加入缓存
            String key = BurialPointConstant.CACHE_ANALYSIS_POINT_CORPORATION_INFO_CODE;
            String value = getKV(key);
            if (StringUtils.isBlank(value)) {
                DataBoardBo dataBoardBo = new DataBoardBo();
                addPhoneNum = addPhoneNum + phoneInfoAnalysisService.countAddPhoneNum(countParam);
                activePhoneNum = activePhoneNum + phoneInfoAnalysisService.countActivePhoneNumByBurialPoint(countParam.getProjectId(), countParam.getStartTime(), countParam.getEndTime());
                countParam.setStartTime(0L);
                allPhoneNum = allPhoneNum + phoneInfoAnalysisService.countAddPhoneNum(countParam);
                allEquipmentNum = allEquipmentNum + equipmentInfoAnalysisService.countEquipmentNum(countParam);
                dataBoardBo.setAddPhoneNum(addPhoneNum);
                dataBoardBo.setActivePhoneNum(activePhoneNum);
                dataBoardBo.setAllPhoneNum(allPhoneNum);
                dataBoardBo.setAllEquipmentNum(allEquipmentNum);
                addKV(key, dataBoardBo.toString(), BurialPointConstant.CACHE_TIME_ONE_DAY);
            } else {
                DataBoardBo dataBoardCacheBo = new DataBoardBo();
                ObjectMapper mapper = new ObjectMapper();
                try {
                    dataBoardCacheBo = mapper.readValue(value, DataBoardBo.class);
                } catch (Exception e) {
                    logger.error("String to dataBoardCacheBo(前缀总公司) error" + e);
                }
                addPhoneNum = dataBoardCacheBo.getAddPhoneNum();
                activePhoneNum = dataBoardCacheBo.getActivePhoneNum();
                allPhoneNum = dataBoardCacheBo.getAllPhoneNum();
                allEquipmentNum = dataBoardCacheBo.getAllEquipmentNum();
            }
        }

        List<Integer> list = new ArrayList<>();
        list.add(0, addPhoneNum);
        list.add(1, activePhoneNum);
        list.add(2, allPhoneNum);
        list.add(3, allEquipmentNum);
        return list;
    }

    /**
     * @param param String companyId;       公司编号
     *              String place;           渠道
     *              String projectId;       项目编号
     *              String firmwareId;      设备固件编号
     *              String firmwareVersion; 设备固件版本号
     *              String appVersion;      app版本号
     *              Long startTime;         查询的开始时间
     *              Long endTime;           查询的结束时间
     * @return addAndActivePhoneList   获得数据看板折线图数据
     */
    private List<List> addAndActivePhoneList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        long startTimeZero = param.getStartTime();
        //近七天按天分组新增手机数和活跃手机数
        CountParam countParam = paramDoService.getParam(param);
        countParam.setStartTime(startTimeZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 7);
        countParam.setEndTime(startTimeZero - 1);
        List<AddAndActivePhoneBo> burialPointAddAndActivePhoneList = burialPointAddAndActivePhoneService.selectAddAndActivePhoneList(countParam);

        //将近七天按天分组新增手机数和活跃手机数分别拼装到List
        List<List> addPhoneSevenDayList = new ArrayList<>();
        List<List> activePhoneSevenDayList = new ArrayList<>();
        Long timePoint = startTimeZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 7;
        for (int i = 0; i < burialPointAddAndActivePhoneList.size(); i++) {
            AddAndActivePhoneBo burialPointAddAndActivePhone = burialPointAddAndActivePhoneList.get(i);
            if (timePoint.equals(burialPointAddAndActivePhone.getCreateTime())) {
                //新增手机
                List<Long> list1 = new ArrayList<>();
                list1.add(0, burialPointAddAndActivePhone.getCreateTime());
                list1.add(1, Long.valueOf(burialPointAddAndActivePhone.getAddPhoneNum()));
                //活跃手机
                List<Long> list2 = new ArrayList<>();
                list2.add(0, burialPointAddAndActivePhone.getCreateTime());
                list2.add(1, Long.valueOf(burialPointAddAndActivePhone.getActivePhoneNum()));
                addPhoneSevenDayList.add(list1);
                activePhoneSevenDayList.add(list2);
                timePoint = timePoint + BurialPointConstant.ONE_DAY_TIME_MILLISECONDS;
            } else {
                //新增手机
                List<Long> list1 = new ArrayList<>();
                list1.add(0, timePoint);
                list1.add(1, 0L);
                //活跃手机
                List<Long> list2 = new ArrayList<>();
                list2.add(0, timePoint);
                list2.add(1, 0L);
                addPhoneSevenDayList.add(list1);
                activePhoneSevenDayList.add(list2);
                timePoint = timePoint + BurialPointConstant.ONE_DAY_TIME_MILLISECONDS;
                i--;
            }
        }
        //当将数据库查询后数据遍历拼接到list后，若list大小小于7,则只执行此循环（即list里最后一位数据并不是查询时间的前一天的数据）
        while (addPhoneSevenDayList.size() < 7) {
            //新增手机
            List<Long> list1 = new ArrayList<>();
            list1.add(0, timePoint);
            list1.add(1, 0L);
            //活跃手机
            List<Long> list2 = new ArrayList<>();
            list2.add(0, timePoint);
            list2.add(1, 0L);
            addPhoneSevenDayList.add(list1);
            activePhoneSevenDayList.add(list2);
            timePoint = timePoint + BurialPointConstant.ONE_DAY_TIME_MILLISECONDS;
        }
        //获取新增手机信息，并拼装到list
        List<List> countAddPhoneList = new ArrayList<>();
        List<Integer> addPhoneNumByMonthList = this.addPhoneList(param);
        countAddPhoneList.add(0, addPhoneNumByMonthList);
        countAddPhoneList.add(1, addPhoneSevenDayList);

        //获取活跃手机信息，并拼装到list
        List<List> countActivePhoneList = new ArrayList<>();
        List<Integer> activePhoneNumByMonthList = this.activePhoneList(param);
        countActivePhoneList.add(0, activePhoneNumByMonthList);
        countActivePhoneList.add(1, activePhoneSevenDayList);

        List<List> countPhoneList = new ArrayList<>();
        countPhoneList.add(0, countAddPhoneList);
        countPhoneList.add(1, countActivePhoneList);
        return countPhoneList;
    }

    /**
     * @param param String companyId;       公司编号
     *              String place;           渠道
     *              String projectId;       项目编号
     *              String firmwareId;      设备固件编号
     *              String firmwareVersion; 设备固件版本号
     *              String appVersion;      app版本号
     *              Long startTime;         查询的开始时间
     *              Long endTime;           查询的结束时间
     * @return addPhoneList   获得本月/上月同比本月同时间段新增手机数、本周/上周同比本周同时间段新增手机数
     */
    private List<Integer> addPhoneList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        long startTimeZero = param.getStartTime();
        long startFirstWeekZero = DateUtil.getTheFirstDayOfWeek(startTimeZero);
        long startFirstMonthZero = DateUtil.getTheFistDayOfMonthDays(startTimeZero);
        CountParam countParam = paramDoService.getParam(param);
        //本周新增手机数
        countParam.setStartTime(startFirstWeekZero);
        countParam.setEndTime(startTimeZero - 1);
        Integer addPhoneThisWeekNum = burialPointAddAndActivePhoneService.sumAddPhoneByExample(countParam);
        if (addPhoneThisWeekNum == null) {
            addPhoneThisWeekNum = 0;
        }

        //上周同比本周同时间段新增手机数
        countParam.setStartTime(startFirstWeekZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 7);
        countParam.setEndTime(startTimeZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 7 - 1);
        Integer addPhoneLastWeekNum = burialPointAddAndActivePhoneService.sumAddPhoneByExample(countParam);
        if (addPhoneLastWeekNum == null) {
            addPhoneLastWeekNum = 0;
        }

        //本月新增手机数
        countParam.setStartTime(startFirstMonthZero);
        countParam.setEndTime(startTimeZero - 1);
        Integer addPhoneThisMonthNum = burialPointAddAndActivePhoneService.sumAddPhoneByExample(countParam);
        if (addPhoneThisMonthNum == null) {
            addPhoneThisMonthNum = 0;
        }

        //上月同比本月同时间段新增手机数
        countParam.setStartTime(startFirstMonthZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 30);
        countParam.setEndTime(startTimeZero - BurialPointConstant.ONE_DAY_TIME_MILLISECONDS * 30 - 1);
        Integer addPhoneLastMonthNum = burialPointAddAndActivePhoneService.sumAddPhoneByExample(countParam);
        if (addPhoneLastMonthNum == null) {
            addPhoneLastMonthNum = 0;
        }

        //将本月/上月同比本月同时间段新增手机数、本周/上周同比本周同时间段新增手机数拼接到List拼接到List
        List<Integer> addPhoneNumByMonthList = new ArrayList<>();
        addPhoneNumByMonthList.add(0, addPhoneThisMonthNum);
        addPhoneNumByMonthList.add(1, addPhoneLastMonthNum);
        addPhoneNumByMonthList.add(2, addPhoneThisWeekNum);
        addPhoneNumByMonthList.add(3, addPhoneLastWeekNum);
        return addPhoneNumByMonthList;
    }

    /**
     * @param param String companyId;       公司编号
     *              String place;           渠道
     *              String projectId;       项目编号
     *              String firmwareId;      设备固件编号
     *              String firmwareVersion; 设备固件版本号
     *              String appVersion;      app版本号
     *              Long startTime;         查询的开始时间
     *              Long endTime;           查询的结束时间
     * @return addPhoneList   根据管理员级别返回不同的本月/上月同比本月同时间段活跃手机数、本周/上周同比本周同时间段活跃手机数
     */
    private List<Integer> activePhoneList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        CountParam countParam = paramDoService.getParam(param);
        ActivePhoneBo activePhoneBo;

        //当登录管理员为项目管理员时执行
        if (countParam.getCompanyId() != null && !StringUtils.isBlank(countParam.getProjectId())) {
            //本月/上月同比本月同时间段活跃手机数、本周/上周同比本周同时间段活跃手机数
            activePhoneBo = burialPointAddAndActivePhoneService.selectActivePhoneByExample(countParam);
        }
        //当登录管理员为公司管理员时执行
        else {
            //本月/上月同比本月同时间段活跃手机数、本周/上周同比本周同时间段活跃手机数
            activePhoneBo = this.getActivePhoneList(countParam);
        }

        //将本月/上月同比本月同时间段活跃手机数、本周/上周同比本周同时间段活跃手机数拼接到List
        List<Integer> activePhoneNumByMonthList = new ArrayList<>();
        activePhoneNumByMonthList.add(0, activePhoneBo.getThisMonthActivePhoneNum());
        activePhoneNumByMonthList.add(1, activePhoneBo.getLastMonthActivePhoneNum());
        activePhoneNumByMonthList.add(2, activePhoneBo.getThisWeekActivePhoneNum());
        activePhoneNumByMonthList.add(3, activePhoneBo.getLastWeekActivePhoneNum());
        return activePhoneNumByMonthList;
    }

    /**
     * @param param String companyId;       公司编号
     *              String place;           渠道
     *              String projectId;       项目编号
     *              String firmwareId;      设备固件编号
     *              String firmwareVersion; 设备固件版本号
     *              String appVersion;      app版本号
     *              Long startTime;         查询的开始时间
     *              Long endTime;           查询的结束时间
     * @return addPhoneList   获得本月/上月同比本月同时间段活跃手机数、本周/上周同比本周同时间段活跃手机数
     */
    private ActivePhoneBo getActivePhoneList(CountParam param) {
        if (param == null) {
            return new ActivePhoneBo();
        }
        CountParam countParam = paramDoService.getParam(param);
        //定义需要用到的时间点
        long theWeekStartTime = DateUtil.getTheFirstDayOfWeek(countParam.getStartTime());
        long theWeekEndTime = countParam.getStartTime() - 1;
        long theMonthStartTime = DateUtil.getTheFistDayOfMonthDays(countParam.getStartTime());
        long theMonthEndTime = countParam.getStartTime() - 1;

        //定义所需要的变量
        int activePhoneThisWeekNum = 0;
        int activePhoneLastWeekNum = 0;
        int activePhoneThisMonthNum = 0;
        int activePhoneLastMonthNum = 0;
        List<String> projectIdWeekList;

        //当登录管理员为分公司管理员时执行
        if (countParam.getCompanyId() != null && StringUtils.isBlank(countParam.getProjectId())) {
            //获取该公司所有的ProjectId
            projectIdWeekList = rpcCompanyInfoService.selectByCompanyId(countParam.getCompanyId());
        }
        //当登录管理员为总公司管理员时执行
        else {
            //获取所有的ProjectId
            projectIdWeekList = rpcAppInfoService.selectAllProjectId();
        }
        //本周/上周同比本周同时间段活跃手机数
        countParam.setStartTime(theWeekStartTime);
        countParam.setEndTime(theWeekEndTime);
        for (String projectId : projectIdWeekList) {
            countParam.setStartTime(theWeekStartTime);
            countParam.setEndTime(theWeekEndTime);
            countParam.setProjectId(projectId);
            Long timeWeek = burialPointAddAndActivePhoneService.selectMaxCreateTimeByProjectId(countParam);
            if (timeWeek != null) {
                countParam.setStartTime(timeWeek);
                countParam.setEndTime(null);
                ActivePhoneBo activePhoneWeekBo = burialPointAddAndActivePhoneService.selectActivePhoneByExample(countParam);
                if (activePhoneWeekBo != null) {
                    activePhoneThisWeekNum = activePhoneThisWeekNum + activePhoneWeekBo.getThisWeekActivePhoneNum();
                    activePhoneLastWeekNum = activePhoneLastWeekNum + activePhoneWeekBo.getLastWeekActivePhoneNum();
                }
            }
            //本月/上月同比本月同时间段活跃手机数
            countParam.setStartTime(theMonthStartTime);
            countParam.setEndTime(theMonthEndTime);
            countParam.setProjectId(projectId);
            Long timeMonth = burialPointAddAndActivePhoneService.selectMaxCreateTimeByProjectId(countParam);
            if (timeMonth != null) {
                countParam.setStartTime(timeMonth);
                countParam.setEndTime(null);
                ActivePhoneBo activePhoneMonthBo = burialPointAddAndActivePhoneService.selectActivePhoneByExample(countParam);
                if (activePhoneMonthBo != null) {
                    activePhoneThisMonthNum = activePhoneThisMonthNum + activePhoneMonthBo.getThisMonthActivePhoneNum();
                    activePhoneLastMonthNum = activePhoneLastMonthNum + activePhoneMonthBo.getLastMonthActivePhoneNum();
                }
            }
        }
        ActivePhoneBo activePhoneBo = new ActivePhoneBo();
        activePhoneBo.setThisWeekActivePhoneNum(activePhoneThisWeekNum);
        activePhoneBo.setLastWeekActivePhoneNum(activePhoneLastWeekNum);
        activePhoneBo.setThisMonthActivePhoneNum(activePhoneThisMonthNum);
        activePhoneBo.setLastMonthActivePhoneNum(activePhoneLastMonthNum);
        return activePhoneBo;
    }

    @Override
    public List<NameAndValueBo> countAppVersionList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        CountParam countParam = paramDoService.getParam(param);
        countParam.setStartTime((long) 0);
        //获取app各个版本的版本号和用户数
        return phoneInfoAnalysisService.countAppVersionAddPhoneNum(countParam);
    }

    @Override
    public List<NameAndValueBo> countFirmwareVersionList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        CountParam countParam = paramDoService.getParam(param);
        countParam.setStartTime((long) 0);
        //获取固件各个版本的版本号和设备数
        return equipmentInfoAnalysisService.countFirmwareVersionAddPhoneNum(countParam);
    }

    @Override
    public List<NameAndValueBo> countPhoneVersionList(CountParam param) {
        if (param == null) {
            return Collections.emptyList();
        }
        CountParam countParam = paramDoService.getParam(param);
        countParam.setStartTime((long) 0);
        //获取手机各个版本的版本号和用户数
        return VersionUtils.getPhoneVersion(phoneInfoAnalysisService.countPhoneVersionAddPhoneNum(countParam));
    }
}
